//
//  @ Project : Galaxy Star Trading System
//  @ File Name : Trade.cpp
//  @ Date : 2014/9/5
//  @ Author :
//
//


#include "../StdInc.h"
#include <boost/format.hpp>
using namespace boost;

namespace GSTrader
{
	namespace TradeBase
	{
		CTrade::CTrade() : m_nID(-1), m_strOrigOrdId(""), m_strInstrumentID(""), m_strTradeID(""), m_nVolume(0), m_dPrice(0), m_nTradeType(0),
			m_strTradingDay(""), m_nOrderId(-1), m_dCommission(0), m_dMargin(0), m_dPremium(0), m_strTransactDate(""), m_strTransactTime(""), m_nProviderId(0),
			m_nInstrumentID(-1), m_nSide(0), m_nOpenClose(0), m_nHedgeFlag(0), m_strConfirmId("")
		{

		}

		CTrade::~CTrade()
		{

		}

		bool CTrade::IsClose()
		{
			return ::IsClose(m_nOpenClose);
		}

		string CTrade::ToString()
		{
			format fmt(g_language == slChinese ? Chinese::c_szFmt6 : English::c_szFmt6);
			fmt % m_strInstrumentID;
			fmt % m_nOrderId;
			fmt % m_dPrice;
			fmt % m_nVolume;
			return fmt.str();
		}
	}
}